package com.jamie.jvm.thread;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 六国枚举
 * @author jamie
 * @date 2021/3/9 22:37
 */
@AllArgsConstructor
public enum CountryEnum {
    /** 六国枚举 */
    ONE(1, "齐"),
    TWO(2, "楚"),
    THREE(3, "燕"),
    FOUR(4, "赵"),
    FIVE(5, "魏"),
    SIX(6, "韩");

    @Getter
    private Integer resCode;
    @Getter
    private String resMessage;

    public static CountryEnum forEachCountryEnum(int index) {
        CountryEnum[] myArray = CountryEnum.values();
        for(CountryEnum countryEnum: myArray){
            if(index == countryEnum.getResCode()){
                return countryEnum;
            }
        }
        return null;
    }

    public String getResMessage() {
        return resMessage;
    }
}
